{"ast":null,"code":"import _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport classNames from 'classnames';\nimport { Item } from 'rc-menu';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport * as React from 'react';\nimport { SiderContext } from '../layout/Sider';\nimport Tooltip from '../tooltip';\nimport { cloneElement, isValidElement } from '../_util/reactNode';\nimport MenuContext from './MenuContext';\nvar MenuItem = function MenuItem(props) {\n  var className = props.className,\n    children = props.children,\n    icon = props.icon,\n    title = props.title,\n    danger = props.danger;\n  var _React$useContext = React.useContext(MenuContext),\n    prefixCls = _React$useContext.prefixCls,\n    firstLevel = _React$useContext.firstLevel,\n    direction = _React$useContext.direction,\n    disableMenuItemTitleTooltip = _React$useContext.disableMenuItemTitleTooltip,\n    isInlineCollapsed = _React$useContext.inlineCollapsed;\n  var renderItemChildren = function renderItemChildren(inlineCollapsed) {\n    var wrapNode = /*#__PURE__*/React.createElement(\"span\", {\n      className: \"\".concat(prefixCls, \"-title-content\")\n    }, children);\n    // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性，则内部包裹一个 span\n    // ref: https://github.com/ant-design/ant-design/pull/23456\n    if (!icon || isValidElement(children) && children.type === 'span') {\n      if (children && inlineCollapsed && firstLevel && typeof children === 'string') {\n        return /*#__PURE__*/React.createElement(\"div\", {\n          className: \"\".concat(prefixCls, \"-inline-collapsed-noicon\")\n        }, children.charAt(0));\n      }\n    }\n    return wrapNode;\n  };\n  var renderItem = function renderItem(_ref) {\n    var _classNames;\n    var siderCollapsed = _ref.siderCollapsed;\n    var _a;\n    var tooltipTitle = title;\n    if (typeof title === 'undefined') {\n      tooltipTitle = firstLevel ? children : '';\n    } else if (title === false) {\n      tooltipTitle = '';\n    }\n    var tooltipProps = {\n      title: tooltipTitle\n    };\n    if (!siderCollapsed && !isInlineCollapsed) {\n      tooltipProps.title = null;\n      // Reset `open` to fix control mode tooltip display not correct\n      // ref: https://github.com/ant-design/ant-design/issues/16742\n      tooltipProps.open = false;\n    }\n    var childrenLength = toArray(children).length;\n    var returnNode = /*#__PURE__*/React.createElement(Item, Object.assign({}, omit(props, ['title', 'icon', 'danger']), {\n      className: classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-danger\"), danger), _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-only-child\"), (icon ? childrenLength + 1 : childrenLength) === 1), _classNames), className),\n      title: typeof title === 'string' ? title : undefined\n    }), cloneElement(icon, {\n      className: classNames(isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', \"\".concat(prefixCls, \"-item-icon\"))\n    }), renderItemChildren(isInlineCollapsed));\n    if (!disableMenuItemTitleTooltip) {\n      returnNode = /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, tooltipProps, {\n        placement: direction === 'rtl' ? 'left' : 'right',\n        overlayClassName: \"\".concat(prefixCls, \"-inline-collapsed-tooltip\")\n      }), returnNode);\n    }\n    return returnNode;\n  };\n  return /*#__PURE__*/React.createElement(SiderContext.Consumer, null, renderItem);\n};\nexport default MenuItem;","map":{"version":3,"names":["classNames","Item","toArray","omit","React","SiderContext","Tooltip","cloneElement","isValidElement","MenuContext","MenuItem","props","className","children","icon","title","danger","useContext","prefixCls","firstLevel","direction","disableMenuItemTitleTooltip","isInlineCollapsed","inlineCollapsed","renderItemChildren","wrapNode","createElement","type","charAt","renderItem","_ref","siderCollapsed","_a","tooltipTitle","tooltipProps","open","childrenLength","length","returnNode","Object","assign","undefined","placement","overlayClassName","Consumer"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/menu/MenuItem.js"],"sourcesContent":["import classNames from 'classnames';\nimport { Item } from 'rc-menu';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport * as React from 'react';\nimport { SiderContext } from '../layout/Sider';\nimport Tooltip from '../tooltip';\nimport { cloneElement, isValidElement } from '../_util/reactNode';\nimport MenuContext from './MenuContext';\nconst MenuItem = props => {\n  const {\n    className,\n    children,\n    icon,\n    title,\n    danger\n  } = props;\n  const {\n    prefixCls,\n    firstLevel,\n    direction,\n    disableMenuItemTitleTooltip,\n    inlineCollapsed: isInlineCollapsed\n  } = React.useContext(MenuContext);\n  const renderItemChildren = inlineCollapsed => {\n    const wrapNode = /*#__PURE__*/React.createElement(\"span\", {\n      className: `${prefixCls}-title-content`\n    }, children);\n    // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性，则内部包裹一个 span\n    // ref: https://github.com/ant-design/ant-design/pull/23456\n    if (!icon || isValidElement(children) && children.type === 'span') {\n      if (children && inlineCollapsed && firstLevel && typeof children === 'string') {\n        return /*#__PURE__*/React.createElement(\"div\", {\n          className: `${prefixCls}-inline-collapsed-noicon`\n        }, children.charAt(0));\n      }\n    }\n    return wrapNode;\n  };\n  const renderItem = _ref => {\n    let {\n      siderCollapsed\n    } = _ref;\n    var _a;\n    let tooltipTitle = title;\n    if (typeof title === 'undefined') {\n      tooltipTitle = firstLevel ? children : '';\n    } else if (title === false) {\n      tooltipTitle = '';\n    }\n    const tooltipProps = {\n      title: tooltipTitle\n    };\n    if (!siderCollapsed && !isInlineCollapsed) {\n      tooltipProps.title = null;\n      // Reset `open` to fix control mode tooltip display not correct\n      // ref: https://github.com/ant-design/ant-design/issues/16742\n      tooltipProps.open = false;\n    }\n    const childrenLength = toArray(children).length;\n    let returnNode = /*#__PURE__*/React.createElement(Item, Object.assign({}, omit(props, ['title', 'icon', 'danger']), {\n      className: classNames({\n        [`${prefixCls}-item-danger`]: danger,\n        [`${prefixCls}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1\n      }, className),\n      title: typeof title === 'string' ? title : undefined\n    }), cloneElement(icon, {\n      className: classNames(isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', `${prefixCls}-item-icon`)\n    }), renderItemChildren(isInlineCollapsed));\n    if (!disableMenuItemTitleTooltip) {\n      returnNode = /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, tooltipProps, {\n        placement: direction === 'rtl' ? 'left' : 'right',\n        overlayClassName: `${prefixCls}-inline-collapsed-tooltip`\n      }), returnNode);\n    }\n    return returnNode;\n  };\n  return /*#__PURE__*/React.createElement(SiderContext.Consumer, null, renderItem);\n};\nexport default MenuItem;"],"mappings":";AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,IAAI,QAAQ,SAAS;AAC9B,OAAOC,OAAO,MAAM,6BAA6B;AACjD,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,oBAAoB;AACjE,OAAOC,WAAW,MAAM,eAAe;AACvC,IAAMC,QAAQ,GAAG,SAAXA,QAAQ,CAAGC,KAAK,EAAI;EACxB,IACEC,SAAS,GAKPD,KAAK,CALPC,SAAS;IACTC,QAAQ,GAINF,KAAK,CAJPE,QAAQ;IACRC,IAAI,GAGFH,KAAK,CAHPG,IAAI;IACJC,KAAK,GAEHJ,KAAK,CAFPI,KAAK;IACLC,MAAM,GACJL,KAAK,CADPK,MAAM;EAER,wBAMIZ,KAAK,CAACa,UAAU,CAACR,WAAW,CAAC;IAL/BS,SAAS,qBAATA,SAAS;IACTC,UAAU,qBAAVA,UAAU;IACVC,SAAS,qBAATA,SAAS;IACTC,2BAA2B,qBAA3BA,2BAA2B;IACVC,iBAAiB,qBAAlCC,eAAe;EAEjB,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkB,CAAGD,eAAe,EAAI;IAC5C,IAAME,QAAQ,GAAG,aAAarB,KAAK,CAACsB,aAAa,CAAC,MAAM,EAAE;MACxDd,SAAS,YAAKM,SAAS;IACzB,CAAC,EAAEL,QAAQ,CAAC;IACZ;IACA;IACA,IAAI,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